/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.yuecai.modules.yc_goods.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
* @website https://el-admin.vip
* @description /
* @author dm
* @date 2020-06-29
**/
@Entity
@Data
@Table(name="yc_goods")
public class YcGoods implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "img",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "主图")
    private String img;

    @Column(name = "slider_image")
    @ApiModelProperty(value = "轮播图")
    private String sliderImage;

    @Column(name = "name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "商品名称")
    private String name;

    @Column(name = "tore_info")
    @ApiModelProperty(value = "商品简介")
    private String toreInfo;

    @Column(name = "activity_id")
    @ApiModelProperty(value = "活动ID")
    private Long activityId;

    @Column(name = "category_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "分类id")
    private Long categoryId;

    @Column(name = "original_price",nullable = false)
    @NotNull
    @ApiModelProperty(value = "原价")
    private BigDecimal originalPrice;

    @Column(name = "vip_discount")
    @ApiModelProperty(value = "vip折扣 例：八折填80")
    private BigDecimal vipDiscount;

    @Column(name = "ficti")
    @ApiModelProperty(value = "虚拟销量")
    private Integer ficti;

    @Column(name = "status")
    @ApiModelProperty(value = "上下架状态1.上架 0.下架")
    private Boolean status;

    @Column(name = "supplier_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "供应商ID")
    private Long supplierId;

    @Column(name = "brand_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "品牌ID")
    private Long brandId;

    @Column(name = "introduction")
    @ApiModelProperty(value = "商品详情")
    private String introduction;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    @Column(name = "postage")
    @ApiModelProperty(value = "邮费(暂时不用)")
    private BigDecimal postage;

    @Column(name = "temp_id")
    @ApiModelProperty(value = "运费模板ID（暂时不用）")
    private Integer tempId;

    @Column(name = "video")
    @ApiModelProperty(value = "视频")
    private String video;

    @Column(name = "is_hot")
    @ApiModelProperty(value = "是否热卖")
    private Boolean isHot;

    @Column(name = "is_new")
    @ApiModelProperty(value = "是否新品")
    private Boolean isNew;

    @Column(name = "special_offer")
    @ApiModelProperty(value = "是否特价")
    private Integer specialOffer;

    @Column(name = "sort")
    @ApiModelProperty(value = "排序")
    private Integer sort;


    public void copy(YcGoods source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}